var keystone = require('keystone');
var Types = keystone.Field.Types;

/**
 * UserProfile Model
 * ==========
 */

var UserProfile = new keystone.List('UserProfile', {
  label: '用户拓展信息',
  singular: '用户拓展信息',
  plural: '用户拓展信息',
});

UserProfile.add({

  user: { type: Types.Relationship, ref: 'User', required: true, initial: true, index: true, unique: true, label: '用户' },

  permission: {
    type: Types.Select, numeric: true,
    options: [{ value: 1, label: '1级权限' },
    { value: 2, label: '2级权限' },
    { value: 3, label: '3级权限' },
    { value: 4, label: '4级权限' },
    ],
    label: '用户权限划分', required: false, initial: true
  },


});

//    

/**
 * Registration
 */
UserProfile.defaultColumns = 'user, permission';
UserProfile.register();
